package com.bigfish.gbs.service.impl;

import com.bigfish.gbs.dao.SupplierMapper;
import com.bigfish.gbs.entity.Supplier;
import com.bigfish.gbs.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Joycessh
 * @Description
 * @Date 12/18/18 10:13 AM
 */
@Service("SupplierService")
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    public SupplierMapper supplierMapper;

    @Override
    public boolean addSupplierMsg(Supplier supplier) {
        int num = supplierMapper.insertSelective(supplier);
        return num == 1? Boolean.TRUE : Boolean.FALSE;
    }

    @Override
    public boolean delSupplierMsg(String userId) {
        int num = supplierMapper.deleteByUserId(userId);
        return num == 1? Boolean.TRUE : Boolean.FALSE;
    }

    @Override
    public Supplier getMsgByUserId(String userId) {
        return supplierMapper.selectByUserId(userId);
    }

    @Override
    public List<Supplier> getSupplier() {
        return supplierMapper.select();
    }
}
